import $ from 'jquery';

const switchDomClasses = function (dom, cl1, cl2) {
  if (!dom.hasClass(cl1) && !dom.hasClass(cl1)) {
    dom.addClass(cl1);
    return;
  }
  if (dom.hasClass(cl1)) {
    dom.removeClass(cl1);
    dom.addClass(cl2);
    return;
  }
  if (dom.hasClass(cl2)) {
    dom.removeClass(cl2);
    dom.addClass(cl1);
    return;
  }
};
const ramdomNums=function (count) {
  var nums = [];
  for(var i=0;i<count;i++){
    var random = Math.floor(Math.random()*(10));
    nums.push(random);
  }
  return nums;
};

const timeInterval = function (min, second) {

  var res1, res2 = "00";
  res1 = parseInt((min * 60 + parseInt(second) - 1) / 60);
  res2 = (min * 60 + parseInt(second) - 1) % 60;
  if (10 > parseInt(res1)) {
    res1 = "0" + res1;
  }
  if (10 > parseInt(res2)) {
    res2 = "0" + res2;
  }
  return "00:" + res1 + ":" + res2;
};
export {
  switchDomClasses,
  ramdomNums,
  timeInterval
}
